﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

namespace MINERP.DAL.CustomerManage
{
    public class CheckOrderInfoDAL
    {
        //private string conStr = ConfigurationManager.ConnectionStrings["fffff"].ToString();
        private string conStr = DALBase.ConnStr;
        public DataTable GetPhotoByOrderProductCode(string orderProductCode)
        {
            SqlConnection con = new SqlConnection(conStr);
            try
            {
                string sql = "select PhotoBarCode,PicPath,OrderProductCode,photoInfo.Remark as PhotoRemark,OrderProductName,CtmName,ShopName from photoInfo,orderInfo,tb_orderbag,shop where orderInfo.orderProductCode='" + orderProductCode + "' and ParentProductId=0 and OrderInfo.orderProductId=photoInfo.orderProductId and orderinfo.orderbagid=tb_orderbag.orderbagid and tb_orderbag.shopid=shop.shopid";
                SqlCommand cmd = new SqlCommand(sql, con);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                con.Open();
                adapter.Fill(dt);
                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
        public DataTable GetOrderInfoByCtmName(string ctmName)
        {
            SqlConnection con = new SqlConnection(conStr);
            try
            {
                string sql = "select OrderProductCode,OrderProductName from orderinfo,tb_orderBag where orderinfo.status=" + 1 + " and ParentProductId=0 and tb_orderbag.status!=" + 8 + " and ctmName like '%" + ctmName + "%' and orderinfo.orderbagid=tb_orderbag.orderbagid";
                SqlCommand cmd = new SqlCommand(sql, con);
                SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
                DataTable dt = new DataTable();
                con.Open();
                adapter.Fill(dt);
                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
    }
}
